﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LINQDemo
{
    public partial class _Default : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
          //LINQ query using Lambda Expressions.
        IEnumerable<Student> students1 = Student.GetAllStudents()
       .Where(student => student.Gender == "Male");

        //LINQ query using using SQL like query expressions
        IEnumerable<Student> students2 = from student in Student.GetAllStudents()
                                                           where student.Gender == "Male"
                                                           select student;

            GridView1.DataSource = students2;
            GridView1.DataBind();
        }
    }
}
